<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="index.html">&lt; 9. Pseudorandom number generator</a><br />
<a href="random_array.html">&lt; 9.3 Getting a random int from a byte array</a><br />
</td><td width="60%">
<p align="center">
=====================================<br />
9.4 Destroying a generator<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
To release ressources used by a generator, use those functions :<br />
NB : do not delete the default random generator !<br />
<p class="code"><pre>
C++ : TCODRandom::~TCODRandom()
C   : void TCOD_random_delete(TCOD_random_t mersenne)
Py  : random_delete(mersenne)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>mersenne</td><td>In the C version, the generator handler, returned by the <a href="random_init.html">initialization functions</a>.<br /></td></tr>
</table>
<br />
Example :<br />
<p class="code"><pre>
C++ : // create a generator
      TCODRandom *rnd = new TCODRandom();
      // use it 
      ...
      // destroy it
      delete rnd;
C   : /* create a generator */
      TCOD_random_t rnd = TCOD_random_new();
      /* use it */ 
      ...
      /* destroy it */
      TCOD_random_delete(rnd);
Py  : # create a generator 
      rnd = libtcod.random_new()
      # use it 
      ...
      # destroy it 
      libtcod.random_delete(rnd)
</pre></p>
